import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Login from '../views/login/Login.vue'

import Index from '../views/Index.vue'
import Echarts from '../views/indexchildren/Echarts.vue'
import Quanxian from '../views/indexchildren/Quanxian.vue'

import User from '../views/indexchildren/User.vue'
import Usermessage from '../views/indexchildren/Usermessage.vue'
import Userupdate from '../views/indexchildren/Userupdate.vue'







const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'login',
    component: Login
  },
  //首页路由
  {
    path: '/index',
    name: 'index',
    component: Index,
    //设置二级路由
    children: [
      //数据展示
      {
        path: '/echarts',
        name: 'echarts',
        component: Echarts,
        meta: {
          title: '数据展示'
        }
      },
      //权限管理
      {
        path: '/quanxian',
        name: 'quanxian',
        component: Quanxian,
        meta: {
          title: "权限列表"
        }
      },
      //住户信息
      {
        path: '/user',
        name: 'user',
        component: User,
        meta: {
          title: "住户信息"
        },
        children: [
          //用户信息展示
          {
            path: '/usermessage',
            name: 'usermessage',
            component: Usermessage,
            meta: {
              classifyTitle: "用户信息",//分类标题
              title: "住户列表"
            }
          },
          //用户信息修改
          {
            path: '/userupdate',
            name: 'userupdate',
            component: Userupdate,
            meta: {
              classifyTitle: "用户信息",//分类标题
              title: "住户信息修改"
            }
          }
        ]
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
